﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using DX_DailyUtil_1._0._1.SerRef_WCF_Hitch;

namespace DX_DailyUtil_1._0._1.ks.ctrl.share
{
    public abstract class Deal_Grid<T>
    {

        protected List<T> mData;
        protected DataGrid mDataGrid;

        public List<T> MData
        {
            get { return mData; }
            set { mData = value; }
        }

        public Deal_Grid()
        {
        }

        public Deal_Grid(DataGrid aDataGrid)
        {
            this.mDataGrid = aDataGrid;
            this.mData = new List<T>();
        }

        public void updateView()
        {
            this.mDataGrid.ItemsSource = null;
            this.mDataGrid.ItemsSource = mData;
        }

        public void add_sync(T aData)
        {
            this.mData.Add(aData);
            this.updateView();
        }

        public void add_async(T aData)
        {
            this.mData.Add(aData);
        }

    }
}
